package com.yanqu.road.server.manger.activity.pixiu;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.pixiu.config.PiXiuAmuseInfo;

import java.util.ArrayList;
import java.util.List;

public class PiXiuConfig {

    private ActivityInfo activityInfo;

    //痒痒挠id
    private int itemId;

    //爪子概率(千分比)
    private int clawWeight;
    //头部概率(千分比)
    private int headWeight;
    //屁股概率(千分比)
    private int buttWeight;

    private List<Integer> weightList;

    private List<PiXiuAmuseInfo> amuseInfoList;

    public PiXiuConfig(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public int getActivityId(){
        if(this.activityInfo == null){
            return 0;
        }
        return activityInfo.getActivityId();
    }

    //查找配置是否存在
    public PiXiuAmuseInfo getPiXiuAmuseInfo(int type, int itemId){
        for (PiXiuAmuseInfo piXiuAmuseInfo : amuseInfoList) {
            if(piXiuAmuseInfo.getType() == type && piXiuAmuseInfo.getItemId() == itemId){
                return piXiuAmuseInfo;
            }
        }
        return null;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public int getClawWeight() {
        return clawWeight;
    }

    public void setClawWeight(int clawWeight) {
        this.clawWeight = clawWeight;
    }

    public int getHeadWeight() {
        return headWeight;
    }

    public void setHeadWeight(int headWeight) {
        this.headWeight = headWeight;
    }

    public int getButtWeight() {
        return buttWeight;
    }

    public void setButtWeight(int buttWeight) {
        this.buttWeight = buttWeight;
    }

    public List<Integer> getWeightList() {
        return weightList;
    }

    public void setWeightList(List<Integer> weightList) {
        this.weightList = weightList;
    }

    public List<PiXiuAmuseInfo> getAmuseInfoList() {
        return amuseInfoList;
    }

    public void setAmuseInfoList(List<PiXiuAmuseInfo> amuseInfoList) {
        this.amuseInfoList = amuseInfoList;
    }

    public void initWeightList() {
        List<Integer> list = new ArrayList<>();
        list.add(clawWeight);
        list.add(headWeight);
        list.add(buttWeight);
        this.weightList = list;
    }

}
